package com.alinesno.cloud.base.boot.web.module.dashboard;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alinesno.cloud.base.boot.entity.ManagerApplicationEntity;
import com.alinesno.cloud.base.boot.service.IManagerApplicationService;
import com.alinesno.cloud.base.boot.web.module.platform.ApplicationController;
import com.alinesno.cloud.common.core.constants.SpringInstanceScope;
import com.alinesno.cloud.common.facade.pageable.DatatablesPageBean;
import com.alinesno.cloud.common.web.base.advice.TranslateCode;
import com.alinesno.cloud.common.web.base.controller.FeignMethodController;

/**
 * 服务监控中心
 * @author WeiXiaoJin
 * @since 2020年1月8日 上午7:28:33
 */
@Controller
@RequestMapping("platform/montor")
@Scope(SpringInstanceScope.PROTOTYPE)
public class PlatformMonitorController extends FeignMethodController<ManagerApplicationEntity , IManagerApplicationService> {

	private static final Logger log = LoggerFactory.getLogger(ApplicationController.class);

	@Autowired
	private IManagerApplicationService managerApplicationFeigin ; 
	
	@TranslateCode("[{hasStatus:has_status}]")
	@ResponseBody
	@PostMapping("/datatables")
    public DatatablesPageBean datatables(HttpServletRequest request , Model model ,  DatatablesPageBean page){
		log.debug("page = {}" , ToStringBuilder.reflectionToString(page));
		return this.toPage(model, managerApplicationFeigin , page) ;
    }

	@Override
	public IManagerApplicationService getFeign() {
		return managerApplicationFeigin ;
	}
	
}
